#include"rclcpp/rclcpp.hpp"
#include"zdys/srv/zdys.hpp"
using zdys::srv::Zdys;
using std::placeholders::_1;
using std::placeholders::_2;
using namespace std::chrono_literals;
class service:public rclcpp::Node{
    private:
    rclcpp::Service<Zdys>::SharedPtr server;
    void gm(const Zdys::Request::SharedPtr req,const Zdys::Response::SharedPtr res){
        if(req->jg>=500){
            res->wbuy=0;
        }
        else res->wbuy=1;
    }
    public:
    service():Node("wserver"){
        server=this->create_service<Zdys>("wbuy",std::bind(&service::gm,this,_1,_2));//  前面的是服务端发送，后面是客服端发送     
        RCLCPP_INFO(this->get_logger(),"服务端启动完毕，等待客服端发送");
    }

};
int main(int argc,char *argv[]){
    rclcpp::init(argc,argv);
    auto server=std::make_shared<service>();
    rclcpp::spin(server);
    rclcpp::shutdown();
    return 0;
}
